SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

CREATE PROCEDURE dbo.[DnnProduct_CDS_AssetsDefaultDRMStampConfigCount]
	@DefaultDRMStampConfigID int,
	@DRMType varchar(20)
AS
BEGIN
	IF (coalesce(@DRMType, 'Stamp') = 'Stamp')
		SELECT COUNT(*) FROM dbo.[DnnProduct_CDS_Assets] A
		JOIN dbo.[DnnProduct_CDS_Templates] T ON A.TemplateID = T.[ID]
		JOIN dbo.[DnnProduct_CDS_StampSets] SS ON SS.TemplateID = T.[ID] AND SS.DefaultStampConfigID = @DefaultDRMStampConfigID
	ELSE
		SELECT COUNT(*) FROM dbo.[DnnProduct_CDS_Assets] A
		JOIN dbo.[DnnProduct_CDS_Templates] T ON A.TemplateID = T.[ID]
		JOIN dbo.[DnnProduct_CDS_StampSets] SS ON SS.TemplateID = T.[ID] AND SS.DefaultDRMStampConfigID = @DefaultDRMStampConfigID
END
GO
